<?php

require_once "mysql_info.php";

if (isset($_POST['latitude']) && isset($_POST['longitude']) && isset($_POST['title']) && isset($_POST['description'])) {
  $latitude = mysql_real_escape_string($_POST['latitude']);
  $longitude = mysql_real_escape_string($_POST['longitude']);
  $title = mysql_real_escape_string($_POST['title']);
  $description = mysql_real_escape_string($_POST['description']);

  $result = db_access("INSERT INTO listings " .
    "(latitude, longitude, title, description) " .
    "VALUES (" . $latitude . ", " . $longitude . ", '" . $title . "', '" . $description . "')");

  echo $result;
} else {
  echo ("Arguments are missing, got: " . $_POST['latitude'] . ", " . $_POST['longitude'] . ", " . $_POST['title'] . ", " . $_POST['description']);
}

?>
